#pragma once
#include <iostream>
#include <string>
#include <vector>
class Pro
{
public:
    Pro(std::string &request) : _request(request)
    {
    }
    // 切割成完整报文
    int cut()
    {
        while (true)
        {
            size_t pos = _request.find("X");
            if (pos != std::string::npos)
            {
                std::string respon;
                respon += _request.substr(0, pos);
                _v.emplace_back(respon);
                _request.erase(0, pos + 1);
                if (_request.empty())
                    break;
            }
            else
                break;
        }
        size_t pos = _request.find("Y");
        if (pos != std::string::npos)
        {
            std::string a = _request.substr(pos - 1, pos);
            _request.erase(0, pos + 1);
            return atoi(a.c_str());
        }
    }

public:
    std::vector<std::string> _v;

private:
    std::string &_request;
};